<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Job Details</f:facet>

        <s:decorate id="jobname" template="layout/display.xhtml">
            <ui:define name="label">Jobname</ui:define>
            <h:outputText value="#{jobHome.instance.jobname}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/JobEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty jobFrom ? 'JobList' : jobFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Timeentries</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="timeentriesChildren">

        <h:outputText value="There are no timeentries associated with this job."
                   rendered="#{empty jobHome.timeentries}"/>

        <rich:dataTable value="#{jobHome.timeentries}"
                       var="_timeentry"
                  rendered="#{not empty jobHome.timeentries}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="timeentriesTable">
            <rich:column sortBy="#{_timeentry.timeentryid}">
                <f:facet name="header">Timeentryid</f:facet>
                <h:outputText value="#{_timeentry.timeentryid}">
                    <f:convertNumber/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_timeentry.startdatetime}">
                <f:facet name="header">Startdatetime</f:facet>
                <h:outputText value="#{_timeentry.startdatetime}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_timeentry.enddatetime}">
                <f:facet name="header">Enddatetime</f:facet>
                <h:outputText value="#{_timeentry.enddatetime}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selecttimeentry"
                     value="Select"
                      view="/Timeentry.xhtml">
                    <f:param name="timeentryTimeentryid"
                            value="#{_timeentry.timeentryid}"/>
                    <f:param name="timeentryFrom" value="Job"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add timeentry"
                view="/TimeentryEdit.xhtml">
            <f:param name="jobJobname"
                    value="#{jobHome.instance.jobname}"/>
            <f:param name="timeentryFrom" value="Job"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Feedbacks</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="feedbacksChildren">

        <h:outputText value="There are no feedbacks associated with this job."
                   rendered="#{empty jobHome.feedbacks}"/>

        <rich:dataTable value="#{jobHome.feedbacks}"
                       var="_feedback"
                  rendered="#{not empty jobHome.feedbacks}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="feedbacksTable">
            <rich:column sortBy="#{_feedback.feedbackid}">
                <f:facet name="header">Feedbackid</f:facet>
                <h:outputText value="#{_feedback.feedbackid}">
                    <f:convertNumber/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_feedback.text}">
                <f:facet name="header">Text</f:facet>
                <h:outputText value="#{_feedback.text}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectfeedback"
                     value="Select"
                      view="/Feedback.xhtml">
                    <f:param name="feedbackFeedbackid"
                            value="#{_feedback.feedbackid}"/>
                    <f:param name="feedbackFrom" value="Job"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add feedback"
                view="/FeedbackEdit.xhtml">
            <f:param name="jobJobname"
                    value="#{jobHome.instance.jobname}"/>
            <f:param name="feedbackFrom" value="Job"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
